<template>
    <tr>
      <td align="center"><input type="checkbox" v-model="items.checked" /></td>
      <td align="center">{{names}}</td>
      <td align="center">{{prices}}</td>
      <td align="center"><button @click="subtraction">-</button>{{nums}}<button @click="nums++">+</button></td>
      <td align="center">{{totalPrice}}</td>
      <td align="center"><button @click="del">删除</button></td>
    </tr>
</template>

<script>
export default {
  data () {
    return {

    }
  },
  props: ['names', 'prices', 'nums', 'items', 'dexs'],
  computed: {
    totalPrice () {
      return this.prices * this.nums
    }

  },
  methods: {
    subtraction () {
      if (this.nums === 1) {
        return alert('最少就是一件，不能再少了')
      }
      this.nums--
    },
    del () {
      this.$emit('dels', this.dexs)
    }

  }
}
</script>

<style scoped lang='less'>

</style>
